package com.qinghuan.ssm.controller;

import com.qinghuan.ssm.pojo.Dept;
import com.qinghuan.ssm.pojo.Msg;
import com.qinghuan.ssm.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: dubao
 * @Date: 2022/4/25 20:22
 * @Description:
 */
@Controller
public class DeptController {

    @Autowired
    private DeptService deptService;

    @RequestMapping("/depts")
    @ResponseBody
    public Msg getDepts() {
        List<Dept> depts = deptService.getDepts();
        return Msg.success().add("depts", depts);
    }

}
